/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package busquedaEstrella;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * Metodos que obtienen los sucesores de un estado dado
 */
public class SucesorE {

    public List<NodoE> hijos; //lista de hijos del estado actual
    public NodoE estadoPadre;
    //Constructor
    public SucesorE (NodoE padre){
        hijos = new ArrayList();
        estadoPadre = padre;
        estadoPadre.setId(padre.getId());
        estadoPadre.setIdPadre(padre.getIdPadre());
        estadoPadre.setG(padre.getG());
        estadoPadre.setCerrado(padre.cerrado);
        
    }
    //Metodo que determina los movimientos posibles segun las posicion del caballo negro
    private ArrayList movimientos(int x, int y){
        //ESTE METODO DEVUELVE LOS MOVIMIENTOS POSIBLES A EFECTUAR
        //POR CADA POSICION DEL CABALLO NEGRO SEGUN SU UBICACION
        ArrayList movs = new ArrayList();
        if((x==0)&&(y==0)){
            //cantidad de movimientos posibles: 2
            int[] mov1;
            mov1 = new int[2];
            mov1[0]=1; //fila
            mov1[1]=2; //columna
            int[]mov2;
            mov2 = new int[2];
            mov2[0]=2;
            mov2[1]=1;
            movs.add(mov1);
            movs.add(mov2);
        }
        //falta hacer por cada posicion del tablero

        if((x==0)&&(y==1)){
            int []mov1;
            int []mov2;
            int []mov3;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 2;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 1;
            mov3[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==0)&&(y==2)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 1;

            mov3[0] = 2;
            mov3[1] = 3;

            mov4[0] = 1;
            mov4[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==0)&&(y==3)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 1;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 2;
            mov3[1] = 4;

            mov4[0] = 1;
            mov4[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==0)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 3;

            mov3[0] = 2;
            mov3[1] = 5;

            mov4[0] = 1;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==0)&&(y==5)){
         int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 3;

            mov2[0] = 2;
            mov2[1] = 4;

            mov3[0] = 2;
            mov3[1] = 6;

            mov4[0] = 1;
            mov4[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==0)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 1;
            mov1[1] = 4;

            mov2[0] = 2;
            mov2[1] = 5;

            mov3[0] = 2;
            mov3[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==0)&&(y==7)){
            int []mov1;
            int []mov2;

            mov1 = new int[2];
            mov2 = new int[2];


            mov1[0] = 1;
            mov1[1] = 5;

            mov2[0] = 2;
            mov2[1] = 6;

            movs.add(mov1);
            movs.add(mov2);

        }

        if((x==1)&&(y==0)){
            int []mov1;
            int []mov2;
            int []mov3;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 0;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==1)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 3;
            mov1[1] = 0;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 0;
            mov3[1] = 3;

            mov4[0] = 2;
            mov4[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==1)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 0;

            mov3[0] = 3;
            mov3[1] = 1;

            mov4[0] = 3;
            mov4[1] = 3;

            mov5[0] = 2;
            mov5[1] = 4;

            mov6[0] = 0;
            mov6[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 1;

            mov2[0] = 2;
            mov2[1] = 1;

            mov3[0] = 3;
            mov3[1] = 2;

            mov4[0] = 3;
            mov4[1] = 4;

            mov5[0] = 2;
            mov5[1] = 5;

            mov6[0] = 0;
            mov6[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 3;
            mov4[1] = 5;

            mov5[0] = 2;
            mov5[1] = 6;

            mov6[0] = 0;
            mov6[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 3;

            mov2[0] = 2;
            mov2[1] = 3;

            mov3[0] = 3;
            mov3[1] = 4;

            mov4[0] = 3;
            mov4[1] = 6;

            mov5[0] = 2;
            mov5[1] = 7;

            mov6[0] = 0;
            mov6[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==1)&&(y==6)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 0;
            mov1[1] = 4;

            mov2[0] = 2;
            mov2[1] = 4;

            mov3[0] = 3;
            mov3[1] = 5;

            mov4[0] = 3;
            mov4[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==1)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 0;
            mov1[1] = 5;

            mov2[0] = 2;
            mov2[1] = 5;

            mov3[0] = 3;
            mov3[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);


        }

        if((x==2)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 0;
            mov1[1] = 1;

            mov2[0] = 1;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 2;

            mov4[0] = 4;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==2)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 0;

            mov2[0] = 0;
            mov2[1] = 2;

            mov3[0] = 1;
            mov3[1] = 3;

            mov4[0] = 3;
            mov4[1] = 3;

            mov5[0] = 4;
            mov5[1] = 0;

            mov6[0] = 4;
            mov6[1] = 2;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==2)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 1;

            mov2[0] = 1;
            mov2[1] = 0;

            mov3[0] = 3;
            mov3[1] = 0;

            mov4[0] = 4;
            mov4[1] = 1;

            mov5[0] = 0;
            mov5[1] = 3;

            mov6[0] = 1;
            mov6[1] = 4;

            mov7[0] = 3;
            mov7[1] = 4;

            mov8[0] = 4;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 2;

            mov2[0] = 1;
            mov2[1] = 1;

            mov3[0] = 3;
            mov3[1] = 1;

            mov4[0] = 4;
            mov4[1] = 2;

            mov5[0] = 0;
            mov5[1] = 4;

            mov6[0] = 1;
            mov6[1] = 5;

            mov7[0] = 3;
            mov7[1] = 5;

            mov8[0] = 4;
            mov8[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 3;

            mov2[0] = 1;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 2;

            mov4[0] = 4;
            mov4[1] = 3;

            mov5[0] = 0;
            mov5[1] = 5;

            mov6[0] = 1;
            mov6[1] = 6;

            mov7[0] = 3;
            mov7[1] = 6;

            mov8[0] = 4;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 0;
            mov1[1] = 4;

            mov2[0] = 1;
            mov2[1] = 3;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 4;

            mov5[0] = 0;
            mov5[1] = 6;

            mov6[0] = 1;
            mov6[1] = 7;

            mov7[0] = 3;
            mov7[1] = 7;

            mov8[0] = 4;
            mov8[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==2)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 0;
            mov1[1] = 5;

            mov2[0] = 1;
            mov2[1] = 4;

            mov3[0] = 3;
            mov3[1] = 4;

            mov4[0] = 4;
            mov4[1] = 5;

            mov5[0] = 0;
            mov5[1] = 7;

            mov6[0] = 4;
            mov6[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==2)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 0;
            mov1[1] = 6;

            mov2[0] = 1;
            mov2[1] = 5;

            mov3[0] = 3;
            mov3[1] = 5;

            mov4[0] = 4;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==3)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 1;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 2;

            mov4[0] = 5;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==3)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 1;
            mov1[1] = 0;

            mov2[0] = 1;
            mov2[1] = 2;

            mov3[0] = 2;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 3;

            mov5[0] = 5;
            mov5[1] = 0;

            mov6[0] = 5;
            mov6[1] = 2;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==3)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 0;

            mov2[0] = 1;
            mov2[1] = 1;

            mov3[0] = 1;
            mov3[1] = 3;

            mov4[0] = 2;
            mov4[1] = 4;

            mov5[0] = 4;
            mov5[1] = 0;

            mov6[0] = 5;
            mov6[1] = 1;

            mov7[0] = 4;
            mov7[1] = 4;

            mov8[0] = 5;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 1;
            mov1[1] = 2;

            mov2[0] = 2;
            mov2[1] = 1;

            mov3[0] = 4;
            mov3[1] = 1;

            mov4[0] = 5;
            mov4[1] = 2;

            mov5[0] = 5;
            mov5[1] = 4;

            mov6[0] = 1;
            mov6[1] = 4;

            mov7[0] = 2;
            mov7[1] = 5;

            mov8[0] = 4;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 1;
            mov1[1] = 3;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 2;

            mov4[0] = 5;
            mov4[1] = 3;

            mov5[0] = 1;
            mov5[1] = 5;

            mov6[0] = 2;
            mov6[1] = 6;

            mov7[0] = 4;
            mov7[1] = 6;

            mov8[0] = 5;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 1;
            mov1[1] = 4;

            mov2[0] = 2;
            mov2[1] = 3;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 5;
            mov4[1] = 4;

            mov5[0] = 1;
            mov5[1] = 6;

            mov6[0] = 2;
            mov6[1] = 7;

            mov7[0] = 4;
            mov7[1] = 7;

            mov8[0] = 5;
            mov8[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==3)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 1;
            mov1[1] = 5;

            mov2[0] = 2;
            mov2[1] = 4;

            mov3[0] = 4;
            mov3[1] = 4;

            mov4[0] = 1;
            mov4[1] = 7;

            mov5[0] = 5;
            mov5[1] = 5;

            mov6[0] = 5;
            mov6[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==3)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 1;
            mov1[1] = 6;

            mov2[0] = 2;
            mov2[1] = 5;

            mov3[0] = 4;
            mov3[1] = 5;

            mov4[0] = 5;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==4)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 2;
            mov1[1] = 1;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 2;

            mov4[0] = 6;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==4)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 2;
            mov1[1] = 0;

            mov2[0] = 2;
            mov2[1] = 2;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 5;
            mov4[1] = 3;

            mov5[0] = 6;
            mov5[1] = 0;

            mov6[0] = 6;
            mov6[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==4)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 1;

            mov2[0] = 3;
            mov2[1] = 0;

            mov3[0] = 5;
            mov3[1] = 0;

            mov4[0] = 6;
            mov4[1] = 1;

            mov5[0] = 2;
            mov5[1] = 3;

            mov6[0] = 3;
            mov6[1] = 4;

            mov7[0] = 5;
            mov7[1] = 4;

            mov8[0] = 6;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 2;

            mov2[0] = 3;
            mov2[1] = 1;

            mov3[0] = 5;
            mov3[1] = 1;

            mov4[0] = 6;
            mov4[1] = 2;

            mov5[0] = 2;
            mov5[1] = 4;

            mov6[0] = 3;
            mov6[1] = 5;

            mov7[0] = 5;
            mov7[1] = 5;

            mov8[0] = 6;
            mov8[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 3;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 2;

            mov4[0] = 6;
            mov4[1] = 3;

            mov5[0] = 2;
            mov5[1] = 5;

            mov6[0] = 3;
            mov6[1] = 6;

            mov7[0] = 5;
            mov7[1] = 6;

            mov8[0] = 6;
            mov8[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 2;
            mov1[1] = 4;

            mov2[0] = 3;
            mov2[1] = 3;

            mov3[0] = 5;
            mov3[1] = 3;

            mov4[0] = 6;
            mov4[1] = 4;

            mov5[0] = 2;
            mov5[1] = 6;

            mov6[0] = 3;
            mov6[1] = 7;

            mov7[0] = 5;
            mov7[1] = 7;

            mov8[0] = 6;
            mov8[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==4)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 2;
            mov1[1] = 5;

            mov2[0] = 3;
            mov2[1] = 4;

            mov3[0] = 5;
            mov3[1] = 4;

            mov4[0] = 6;
            mov4[1] = 5;

            mov5[0] = 2;
            mov5[1] = 7;

            mov6[0] = 6;
            mov6[1] = 7;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==4)&&(y==7)){
            int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 2;
            mov1[1] = 6;

            mov2[0] = 3;
            mov2[1] = 5;

            mov3[0] = 5;
            mov3[1] = 5;

            mov4[0] = 6;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==5)&&(y==0)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 3;
            mov1[1] = 1;

            mov2[0] = 4;
            mov2[1] = 2;

            mov3[0] = 6;
            mov3[1] = 2;

            mov4[0] = 7;
            mov4[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==5)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 3;
            mov1[1] = 0;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 6;
            mov4[1] = 3;

            mov5[0] = 7;
            mov5[1] = 0;

            mov6[0] = 7;
            mov6[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==5)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 0;

            mov2[0] = 3;
            mov2[1] = 1;

            mov3[0] = 3;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 4;

            mov5[0] = 6;
            mov5[1] = 4;

            mov6[0] = 7;
            mov6[1] = 3;

            mov7[0] = 7;
            mov7[1] = 1;

            mov8[0] = 6;
            mov8[1] = 0;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==5)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 1;

            mov2[0] = 3;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 4;
            mov4[1] = 5;

            mov5[0] = 6;
            mov5[1] = 5;

            mov6[0] = 7;
            mov6[1] = 4;

            mov7[0] = 7;
            mov7[1] = 2;

            mov8[0] = 6;
            mov8[1] = 1;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }
        if((x==5)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 2;

            mov2[0] = 3;
            mov2[1] = 3;

            mov3[0] = 3;
            mov3[1] = 5;

            mov4[0] = 4;
            mov4[1] = 6;

            mov5[0] = 6;
            mov5[1] = 6;

            mov6[0] = 7;
            mov6[1] = 5;

            mov7[0] = 7;
            mov7[1] = 3;

            mov8[0] = 6;
            mov8[1] = 2;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==5)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int []mov5;
            int []mov6;
            int []mov7;
            int []mov8;
            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];
            mov7 = new int[2];
            mov8 = new int[2];

            mov1[0] = 4;
            mov1[1] = 3;

            mov2[0] = 3;
            mov2[1] = 4;

            mov3[0] = 3;
            mov3[1] = 6;

            mov4[0] = 4;
            mov4[1] = 7;

            mov5[0] = 6;
            mov5[1] = 7;

            mov6[0] = 7;
            mov6[1] = 6;

            mov7[0] = 7;
            mov7[1] = 4;

            mov8[0] = 6;
            mov8[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
            movs.add(mov7);
            movs.add(mov8);
        }

        if((x==5)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 4;
            mov1[1] = 4;

            mov2[0] = 3;
            mov2[1] = 5;

            mov3[0] = 3;
            mov3[1] = 7;

            mov4[0] = 6;
            mov4[1] = 4;

            mov5[0] = 7;
            mov5[1] = 5;

            mov6[0] = 7;
            mov6[1] = 7;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==5)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 3;
            mov1[1] = 6;

            mov2[0] = 4;
            mov2[1] = 5;

            mov3[0] = 7;
            mov3[1] = 6;

            mov4[0] = 6;
            mov4[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);

        }

        if((x==6)&&(y==0)){
            int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 4;
            mov1[1] = 1;

            mov2[0] = 5;
            mov2[1] = 2;

            mov3[0] = 7;
            mov3[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);

        }

        if((x==6)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 4;
            mov1[1] = 0;

            mov2[0] = 4;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 3;

            mov4[0] = 7;
            mov4[1] = 3;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==6)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 0;

            mov2[0] = 4;
            mov2[1] = 1;

            mov3[0] = 4;
            mov3[1] = 3;

            mov4[0] = 5;
            mov4[1] = 4;

            mov5[0] = 7;
            mov5[1] = 0;

            mov6[0] = 7;
            mov6[1] = 4;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 1;

            mov2[0] = 4;
            mov2[1] = 2;

            mov3[0] = 4;
            mov3[1] = 4;

            mov4[0] = 5;
            mov4[1] = 5;

            mov5[0] = 7;
            mov5[1] = 1;

            mov6[0] = 7;
            mov6[1] = 5;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 2;

            mov2[0] = 4;
            mov2[1] = 3;

            mov3[0] = 4;
            mov3[1] = 5;

            mov4[0] = 5;
            mov4[1] = 6;

            mov5[0] = 7;
            mov5[1] = 6;

            mov6[0] = 7;
            mov6[1] = 2;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;
            int[]mov5;
            int []mov6;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];
            mov5 = new int[2];
            mov6 = new int[2];

            mov1[0] = 5;
            mov1[1] = 3;

            mov2[0] = 4;
            mov2[1] = 4;

            mov3[0] = 4;
            mov3[1] = 6;

            mov4[0] = 5;
            mov4[1] = 7;

            mov5[0] = 7;
            mov5[1] = 3;

            mov6[0] = 7;
            mov6[1] = 7;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
            movs.add(mov5);
            movs.add(mov6);
        }

        if((x==6)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 4;
            mov1[1] = 5;

            mov2[0] = 4;
            mov2[1] = 7;

            mov3[0] = 5;
            mov3[1] = 4;

            mov4[0] = 7;
            mov4[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==6)&&(y==7)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 4;
            mov1[1] = 6;

            mov2[0] = 5;
            mov2[1] = 5;

            mov3[0] = 7;
            mov3[1] = 5;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);

        }

        if((x==7)&&(y==0)){
            int []mov1;
            int []mov2;

            mov1 = new int[2];
            mov2 = new int[2];

            mov1[0] = 5;
            mov1[1] = 1;

            mov2[0] = 6;
            mov2[1] = 2;

            movs.add(mov1);
            movs.add(mov2);

        }

        if((x==7)&&(y==1)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 5;
            mov1[1] = 0;

            mov2[0] = 5;
            mov2[1] = 2;

            mov3[0] = 6;
            mov3[1] = 3;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
        }

        if((x==7)&&(y==2)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 0;

            mov2[0] = 5;
            mov2[1] = 1;

            mov3[0] = 5;
            mov3[1] = 3;

            mov4[0] = 6;
            mov4[1] = 4;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==3)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 1;

            mov2[0] = 5;
            mov2[1] = 2;

            mov3[0] = 5;
            mov3[1] = 4;

            mov4[0] = 6;
            mov4[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==4)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 2;

            mov2[0] = 5;
            mov2[1] = 3;

            mov3[0] = 5;
            mov3[1] = 5;

            mov4[0] = 6;
            mov4[1] = 6;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==5)){
        int []mov1;
            int []mov2;
            int []mov3;
            int []mov4;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];
            mov4 = new int[2];

            mov1[0] = 6;
            mov1[1] = 3;

            mov2[0] = 5;
            mov2[1] = 4;

            mov3[0] = 5;
            mov3[1] = 6;

            mov4[0] = 6;
            mov4[1] = 7;

            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);
            movs.add(mov4);
        }

        if((x==7)&&(y==6)){
        int []mov1;
            int []mov2;
            int []mov3;

            mov1 = new int[2];
            mov2 = new int[2];
            mov3 = new int[2];

            mov1[0] = 5;
            mov1[1] = 5;

            mov2[0] = 5;
            mov2[1] = 7;

            mov3[0] = 6;
            mov3[1] = 4;


            movs.add(mov1);
            movs.add(mov2);
            movs.add(mov3);

        }

        if((x==7)&&(y==7)){
        int []mov1;
            int []mov2;


            mov1 = new int[2];
            mov2 = new int[2];


            mov1[0] = 5;
            mov1[1] = 6;

            mov2[0] = 6;
            mov2[1] = 5;

            movs.add(mov1);
            movs.add(mov2);
        }
        return movs;
    }
    //Metodo que obtiene los sucesores del nodo recibido
    public int obtenerHijos(int idConsecutivo){
        int filaCn = 0;
        int colCn = 0;
        filaCn = this.getEstadoPadre().filaCN();
        colCn = this.getEstadoPadre().colCN();
        int nuevaFila = 0;
        int nuevaCol = 0;
        int retornaRegla = 0;
   //regla1
        nuevaFila = filaCn + 1;
        nuevaCol = colCn + 2;
        boolean aplico1 = false;
        aplico1 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
        if(aplico1){
            System.out.println("Aplico la regla n°1");
            idConsecutivo = idConsecutivo + 1;
        }

   //regla 2
            nuevaFila = filaCn + 2;
            nuevaCol = colCn - 1;
            boolean aplico2 = false;
            aplico2 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
            if(aplico2){
           System.out.println("Aplico la regla n°2");
           idConsecutivo = idConsecutivo + 1;
            }
    //regla 3
      nuevaFila = filaCn + 2;
      nuevaCol = colCn - 1;
      boolean aplico3 = false;
      aplico3 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
      if(aplico3){
            System.out.println("Aplico la regla n°3");
            idConsecutivo = idConsecutivo + 1;
        }

   //regla4
        nuevaFila = filaCn - 1;
        nuevaCol = colCn - 2;
        boolean aplico4 = false;
        aplico4 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
        if(aplico4){
            System.out.println("Aplico la regla n°4");
            idConsecutivo = idConsecutivo + 1;
        }
   //regla5
        nuevaFila = filaCn - 2;
        nuevaCol = colCn + 1;
        boolean aplico5 = false;
        aplico5 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
        if(aplico5){
            System.out.println("Aplico la regla n°5");
            idConsecutivo = idConsecutivo + 1;
        }

   //regla 6
        nuevaFila = filaCn + 2;
        nuevaCol = colCn + 1;
        boolean aplico6 = false;
        aplico6 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
        if(aplico6){
            System.out.println("Aplico la regla n°6");
            idConsecutivo = idConsecutivo + 1;
        }
   //regla7

        nuevaFila = filaCn + 1;
        nuevaCol = colCn - 2;
        boolean aplico7 = false;
        aplico7 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
        if(aplico7){
            System.out.println("Aplico la regla n°7");
            idConsecutivo = idConsecutivo + 1;
        }
   //regla 8
        nuevaFila = filaCn - 2;
        nuevaCol = colCn - 1;
        boolean aplico8 = false;
        aplico8 = this.aplicarReglas(nuevaFila, nuevaCol, idConsecutivo);
        if(aplico8){
            System.out.println("Aplico la regla n°8");
            idConsecutivo = idConsecutivo + 1;
        }
        return idConsecutivo;

}
    //Metodo que aplica la regla al tablero
    public boolean aplicarReglas(int nuevaFila, int nuevaCol, int idRecibido){
    boolean encontro = false;
    List <int []> movimiento;
    movimiento = new ArrayList();
    movimiento = this.movimientos(this.getEstadoPadre().filaCN(), this.getEstadoPadre().colCN());

    for(int i = 0; i<movimiento.size(); i++){
            int [] aux;
            aux = movimiento.get(i);
            if((aux[0] == nuevaFila)&&(aux[1]==nuevaCol)){
                encontro = true;
                // se puede aplicar el operador de movimiento
            }
        }
        if(encontro){
            //aplica la primer regla que puede
            NodoE hijo = new NodoE(this.getEstadoPadre().getPosicion(),this.estadoPadre.getId(),idRecibido,this.estadoPadre.getNivel() + 1,this.getEstadoPadre().getG()+1);
            hijo.modificarPosicion(this.getEstadoPadre().filaCN(), this.getEstadoPadre().colCN(), 0);
            hijo.modificarPosicion(nuevaFila, nuevaCol, 2);
            hijo.actualizarPesos();

            hijo.calcularF();

            this.getHijos().add(hijo);

        }
        return encontro;

    }

    //Getters y Setters
    public List<NodoE> getHijos() {
        return hijos;
    }

    /**
     * @param hijos the hijos to set
     */
    public void setHijos(List<NodoE> hijos) {
        this.hijos = hijos;
    }

    /**
     * @return the estadoPadre
     */
    public NodoE getEstadoPadre() {
        return estadoPadre;
    }

    /**
     * @param estadoPadre the estadoPadre to set
     */
    public void setEstadoPadre(NodoE estadoPadre) {
        this.estadoPadre = estadoPadre;
    }

}
